package com.shujia.day20.lambda10;

import java.util.Arrays;
import java.util.List;

interface Inter{
    List<Staff> getStaff(Staff... staffs);
}

public class Demo1 {
    public static void main(String[] args) {
        Staff s1 = new Staff("sj1001", "李刚", 18, 35000);
        Staff s2 = new Staff("sj1002", "钱志强", 13, 20000);
        Staff s3 = new Staff("sj1003", "江川", 24, 50000);
        Staff s4 = new Staff("sj1004", "祝帅", 16, 21000);
        Staff s5 = new Staff("sj1005", "吴问强", 8, 8000);
//        List<Staff> staffList = fun1(staffs -> Arrays.asList(staffs), s1, s2, s3, s4, s5);
        /**
         *  假如 Lambda 表达式符合如下格式：
         *      ([变量1, 变量2, ...]) -> 类名.静态方法名([变量1, 变量2, ...])
         * 我们可以简写成如下格式：
         *      类名::静态方法名
         */
        List<Staff> staffList = fun1(Arrays::asList, s1, s2, s3, s4, s5);
        for (Staff staff : staffList) {
            System.out.println(staff);
        }

    }

    public static List<Staff> fun1(Inter inter, Staff... staffs){
        return inter.getStaff(staffs);
    }
}
